<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/******************************************************
* Profile			: site_infomation 
* Author			: 乔伟
* Create Time		: 2011-10-14 
* Modify Time		: 2011-10-14 
* Modify Profile	:  
******************************************************/
class site_info extends Admin_Controller {

	public function __construct()
	{
		parent::__construct();
	}
	/******************************************************
	* Profile		: 编辑
	* Author		: 乔伟
	* Create Time		: 2011-10-14 
	* Modify Time		: 2011-10-14
	* Modify Profile	:  
	******************************************************/
	public function edit()
	{ 
		if(!$this->is_postback())
		{
			$site_info = $this->site_info_manager->get(Load_Type::Normal);
		}
		else
		{
			$this->load->library('form_validation');
			
			if ($this->form_validation->run('site_info') == TRUE)
			{
				$post_site_info = $this->filter_post($_POST,'p_','p_seo_');
				$post_seo = $this->filter_post($_POST,'p_seo_');
				$post_site_info['seo'] = $post_seo;
				$this->site_info_manager->update($post_site_info);
				$site_info = (object)$post_site_info; 
				$site_info->seo = (object)$post_seo; 
				$site_info->error = "成功";
				// redirect(SELF.'/site_info/edit');
			}
		}

        $cache_folder = FCPATH."application/cache/";
        delete_files($cache_folder);
		// print_r($site_info);
		$this->load->view('admin/site_info/v_form',$site_info);
	}
	
	public function home()
	{
		
	}
}
